import Vue from 'vue'
import Router from 'vue-router'
import Login from '../views/login'
import HomePageBody from '../views/front/homeBody'
import Register from '../views/register'
import NotFound from '../views/error/notFound'
import WriteArticle from '../views/front/writeArticle'
import WriteProblem from '../views/front/writeProblem'
import ProblemInfo from '../views/front/problemInfo/problemInfo'
import SearchInfo from '../views/front/seacrchInfo/searchInfo'
import SearchResultInfo from '../views/front/seacrchInfo/searchResultInfo'
import ResourceHome from '../views/front/resourceCenter/resourceHome'
import SelfHome from '../views/front/selfInfo/selfHome'
import UploadFileByUser from '../views/front/resourceCenter/uploadFileByUser'
import ResourceInfo from  '../views/front/resourceCenter/resourceInfo'

import Chat from '../views/front/chat/chat'
Vue.use(Router)


export default new Router({
      routes: [
        {
          //登录首页
          path:"/login",
          name:"login",
          component:Login,
        },
        {
          //注册也
          path:"/register",
          name:"register",
          component:Register
        },
        {
          //首页
          path:"/home",
          name:"homeBody",
          component:HomePageBody,
          meta: {
            requireAuth: true
          },
          redirect:"/home/searchInfo",
          children:[{
            path:"searchInfo",
            name:"SearchInfo",
            component:SearchInfo
          },{
            //文章信息
            path:"problemInfo",
            name:"ProblemInfo",
            component:ProblemInfo,
            meta: {
              requireAuth: true
            }
          },{//查询结果
            path:"searchResultInfo",
            name:"SearchResultInfo",
            component:SearchResultInfo,
            meta: {
              requireAuth: true
            }
          },{
            path:"resourceHome",
            name:"ResourceHome",
            component:ResourceHome,
            meta:{
              requireAuth: true
            }
          },{
            path:"resourceInfo",
            name:"ResourceInfo",
            component:ResourceInfo,
            meta:{
              requireAuth: true
            }
          },{
            path:"selfHome",
            name:"SelfHome",
            component:SelfHome,
            meta:{
              requireAuth: true
            }
          }


          ]
        },
        {
          //写文章信息
          path:"/writeArticle",
          name:"writeArticle",
          component:WriteArticle,
          meta: {
            requireAuth: true
          }
        },{
          path:"/uploadFileByUser",
          name:"UploadFileByUser",
          component:UploadFileByUser,
          meta:{
            requireAuth: true
          }
        },
        {
          //聊天
          path:"/chat",
          name:"Chat",
          component:Chat,
          meta: {
            requireAuth: true
          }
        },
        {
          //写文章信息
          path:"/writeProblem",
          name:"writeProblem",
          component:WriteProblem,
          meta: {
            requireAuth: true
          }
        },
        //错误页面
        {
          path:'*',
          component:NotFound
        }
    ]
  })
